package cn.monkey.family.server.domain.sys.file;

import cn.monkey.family.data.Result;
import cn.monkey.family.data.context.RequestContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import java.io.IOException;

public interface IFileHandler {

    default String getName() {
        return this.getClass().getSimpleName();
    }

    default void download(RequestContext requestContext,
                          HttpServletRequest request,
                          HttpServletResponse response) throws IOException {
        throw new UnsupportedOperationException();
    }

    default Result<?> upload(RequestContext requestContext, MultipartHttpServletRequest request) throws IOException {
        throw new UnsupportedOperationException();
    }

}
